/*
 *	DjoltNode.h
 *
 *	David Janes
 *	Discover Anywhere Mobile
 *	March 2010
 *
 *	Copyright 2010 Discover Anywhere Mobile
 *
 *	Purpose:
 *	This holds the nested parse structure - everything in
 *	a template is converted to a 'Node' of some sort
 *
 *	Programmers:
 *	Modify this if you want to add more {% xxx %} type 
 *	Django commands. You'll also have to add a few lines
 *	of code to DjoltTemplate.m
 */

#import <Foundation/Foundation.h>

@class DjoltContext;

/*
 */
@interface DjoltNode : NSObject
{
	DjoltNode*		parent;
	NSMutableArray*	children;

	NSString*		text;
	NSString*		path;
	NSString*		arguments;
}

@property(nonatomic,retain) DjoltNode*		parent;
@property(nonatomic,retain) NSMutableArray*	children;
@property(nonatomic,retain) NSString*		text;
@property(nonatomic,retain) NSString*		path;
@property(nonatomic,retain) NSString*		arguments;

- (id) init;
- (id) initWithParent:(DjoltNode*)_parent;
- (void) assertIsClass:(id)_class;
- (void) addChild:(DjoltNode*)_node;
- (void) render:(DjoltContext*)_context into:(NSMutableString*)_result;
@end

/*
 */
@interface DjoltNodeRoot : DjoltNode
{
}
@end

/*
 */
@interface DjoltNodeText : DjoltNode
{
}

- (id) initWithText:(NSString*)_text;
@end

/*
 */
@interface DjoltNodeVariable : DjoltNode
{
}

- (id) initWithExpression:(NSString*)_expression;
@end

/*
 */
@interface DjoltNodeFor : DjoltNode
{
}

- (id) initWithParent:(DjoltNode*)_parent arguments:(NSString*)_arguments;
@end


/*
 */
@interface DjoltNodeInvertable : DjoltNode
{
	BOOL	invert;
}

- (DjoltNodeInvertable*) invert;
@end

/*
 */
@interface DjoltNodeIf : DjoltNodeInvertable
{
}

- (id) initWithParent:(DjoltNode*)_parent arguments:(NSString*)_arguments;
- (id) initWithIf:(DjoltNode*)_if_node;
@end

/*
 */
@interface DjoltNodeIfEqual : DjoltNodeInvertable
{
}

- (id) initWithParent:(DjoltNode*)_parent arguments:(NSString*)_arguments inverted:(BOOL)_inverted;
- (id) initWithIfEqual:(DjoltNode*)_ifequal_node;
@end

/*
 */
@interface DjoltNodeComment : DjoltNode
{
}
- (id) initWithParent:(DjoltNode*)_parent;
@end
